﻿using ViewMaker.Core.Controls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using ViewMaker.Core;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows;

namespace ViewMaker.Core.Tests
{
    [TestClass()]
    public class HeaderViewControlTest
    {
        [TestMethod()]
        public void 標準的なHeaderのXAML生成()
        {
            HeaderViewControl target = new LabelViewControl { Item = new ViewLayoutItem { Name = "lb001", Caption = "ヘッダー付", BindPath = "currentValue" } };
            var headerXaml = target.CreateXaml(TestHelper.CreateTestParent())[0];
            var actual = TestHelper.GetFrameworkElement<Label>(headerXaml);
            Assert.AreEqual("ヘッダー付", actual.Content);
            Assert.AreEqual(double.NaN, actual.Width);
            Assert.AreEqual(HorizontalAlignment.Left, actual.HorizontalContentAlignment);
        }

        [TestMethod()]
        public void 幅位置指定なHeaderのXAML生成()
        {
            HeaderViewControl target = new LabelViewControl { Item = new ViewLayoutItem { Name = "lb001", Caption = "ヘッダー付", BindPath = "currentValue" } };
            target.HeaderWidth = 100;
            target.HeaderHorizontalContentAlignment = LayoutHorizontalAlignment.Center;
            var headerXaml = target.CreateXaml(TestHelper.CreateTestParent())[0];
            var actual = TestHelper.GetFrameworkElement<Label>(headerXaml);
            Assert.AreEqual("ヘッダー付", actual.Content);
            Assert.AreEqual(100, actual.Width);
            Assert.AreEqual(HorizontalAlignment.Center, actual.HorizontalContentAlignment);
        }

    }
}
